-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pipeline from config file #220
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…into feature/config-files
willtai
reviewed
Nov 28, 2024
…into feature/config-files
…into feature/config-files # Conflicts: # CHANGELOG.md # poetry.lock # pyproject.toml
willtai
reviewed
Dec 12, 2024
willtai
reviewed
Dec 12, 2024
willtai
reviewed
Dec 12, 2024
willtai
approved these changes
Dec 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adds the ability to instantiate a
Pipeline
from a config file. Used to simplify the internal implementation ofSimpleKGPipeline
(without any API change).Supports JSON and YAML file format. Example config for SimpleKGPipeline
The goal of this implementation was to be able to use the same objects when user writes Python code and when he is using a config file that needs to be parsed to instantiate objects such as neo4j driver and LLMs, without duplicating code.
The main additions are
neo4j_graphrag.experimental.pipeline.config.runner.PipelineRunner
class, able to create a pipeline from anAbstractPipelineConfig
(code) object or config filePipelineConfigWrapper
is the 'router': depending on thetemplate_
field, it will instantiate either aPipelineConfig
orSimpleKGPipelineConfig
. In the former case, all cmponents and connections need to be defined in the config. In the later, shortcuts are possible (same interface as theSimpleKGPipeline
).ParamToResolveConfig
: used to define parameter in config file other than providing its direct value. For instance, to read Neo4j password from env variables, user can write:Only two "resolvers" are supported for now:
neo4j_config
) later in the config file (in a component definition) (note thatneo4j_config
is a top level config because it can be reused in multiple components)Neo4jDriver
-,LLM
- andEmbeddings
-Type
: wrapper around an already instantiated object (when the config is used in code) and a*Config
object that contains the relevant field to do the instantiation (when used from config file). Theparse
method always return an object. For instance:Changes
SimpleKGPipeline
internals changed to use the newPipelineRunner
.Type of Change
Complexity
Complexity: High
How Has This Been Tested?
Checklist
The following requirements should have been met (depending on the changes in the branch):